using System.Linq;
using System.Text;
using System.Diagnostics;
using System.Runtime.Serialization;
using System.Collections;
using System.Data;
using System.ComponentModel;
using System.Data.OracleClient;
using WPFExcelReport.Helpers;
using WPFExcelReport.Controls;
namespace WPFExcelReport
{
    public partial class VICC_WFEVENTSGROUP
    {

        public string MANDANT { get { if (dwMaster == null) return ""; return dwMaster["MANDANT"].ToString(); } set { if (dwMaster == null) return; dwMaster["MANDANT"] = value; OnPropertyChanged("MANDANT", value); } } //lENGth 2
        public string ROWNID { get { if (dwMaster == null) return ""; return dwMaster["ROWNID"].ToString(); } set { if (dwMaster == null) return; dwMaster["ROWNID"] = value; OnPropertyChanged("ROWNID", value); } } //lENGth 20
        public string WFTYPE { get { if (dwMaster == null) return ""; return dwMaster["WFTYPE"].ToString(); } set { if (dwMaster == null) return; dwMaster["WFTYPE"] = value; OnPropertyChanged("WFTYPE", value); } } //lENGth 3
        public string WFTDES { get { if (dwMaster == null) return ""; return dwMaster["WFTDES"].ToString(); } set { if (dwMaster == null) return; dwMaster["WFTDES"] = value; OnPropertyChanged("WFTDES", value); } } //lENGth 40
        public string NEWUSER { get { if (dwMaster == null) return ""; return dwMaster["NEWUSER"].ToString(); } set { if (dwMaster == null) return; dwMaster["NEWUSER"] = value; OnPropertyChanged("NEWUSER", value); } } //lENGth 8
        public string NEWTIME { get { if (dwMaster == null) return ""; return dwMaster["NEWTIME"].ToString(); } set { if (dwMaster == null) return; dwMaster["NEWTIME"] = value; OnPropertyChanged("NEWTIME", value); } } //lENGth 20
        public string CHGUSER { get { if (dwMaster == null) return ""; return dwMaster["CHGUSER"].ToString(); } set { if (dwMaster == null) return; dwMaster["CHGUSER"] = value; OnPropertyChanged("CHGUSER", value); } } //lENGth 8
        public string CHGTIME { get { if (dwMaster == null) return ""; return dwMaster["CHGTIME"].ToString(); } set { if (dwMaster == null) return; dwMaster["CHGTIME"] = value; OnPropertyChanged("CHGTIME", value); } } //lENGth 20

    }
    public partial class VICC_WFEVENTSGROUP
    {
        public void SetUpNewRow(ref DataRow dwReturn)
        {

            switch (app.company)
            {
                case "YGR":
                case "YCC":
                default:
                    #region=========
                    dwReturn["MANDANT"] = "00";
                    dwReturn["ROWNID"] = INTEXDBC.GetSeq();
                    dwReturn["WFTYPE"] = "A  ";
                    dwReturn["WFTDES"] = "                                        ";
                    dwReturn["NEWUSER"] = "        ";
                    dwReturn["NEWTIME"] = "20140916";
                    dwReturn["CHGUSER"] = "";
                    dwReturn["CHGTIME"] = "";
                    #endregion
                    break;
            }
        }
        public void MapICC_WFEVENTSGROUP(ref DataRow dwLocal, DataRow dwData)
        {
            BlindMap(ref dwLocal, dwData);
        }

        public void InsertICC_WFEVENTSGROUP(DataRow dwData, string ITXDBVERSION = "50.24")
        {

            or1 = OracleDB.CreateCommand();
            dwData["NEWUSER"] = app.User;
            dwData["NEWTIME"] = date;
            or1.CommandText = "INSERT INTO ICC_WFEVENTSGROUP(MANDANT,ROWNID,WFTYPE,WFTDES,NEWUSER,NEWTIME,CHGUSER,CHGTIME)"
                        + " VALUES (:MANDANT:,:ROWNID:,:WFTYPE:,:WFTDES:,:NEWUSER:,:NEWTIME:,:CHGUSER:,:CHGTIME:)";
            or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
            Connect2Proxy(or1);
        }
        public void DeleteICC_WFEVENTSGROUP(DataRow dwData, int option = 1)
        {
            or1 = OracleDB.CreateCommand();
            switch (option)
            {
                case 1:
                    or1.CommandText = "DELETE FROM ICC_WFEVENTSGROUP WHERE  ROWNID=:ROWNID:"; ;
                    or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
                    SResult = Connect2Proxy(or1);
                    break;
            }
        }
        public DataSet QueryICC_WFEVENTSGROUP(DataRow dwData, int option = 1)
        {
            or1 = OracleDB.CreateCommand();
            switch (option)
            {
                case 1:
                    or1.CommandText = "SELECT * FROM ICC_WFEVENTSGROUP WHERE  ROWNID=:ROWNID:"; ;
                    or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
                    SResult = Connect2Proxy(or1);
                    break;
                case 4:
                    or1.CommandText = "SELECT * FROM ICC_WFEVENTSGROUP WHERE  MANDANT=:MANDANT:"; ;
                    or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
                    SResult = Connect2Proxy(or1);
                    break;
                case 9999:
                    or1.CommandText = "SELECT WFTYPE AS KEY,WFTDES AS DES,M.* FROM ICC_WFEVENTSGROUP M";
                    SResult = Connect2Proxy(or1);
                    break;
                default:
                    break;
            }
            SResult.Tables[0].TableName = TableName;
            return SResult;
        }
        public void UpdateICC_WFEVENTSGROUP(DataRow dwData, int option = 1)
        {
            dwData["CHGUSER"] = app.User;
            dwData["CHGTIME"] = date;
            or1 = OracleDB.CreateCommand();
            or1.CommandText = "UPDATE ICC_WFEVENTSGROUP SET "
                + "MANDANT=:MANDANT:, WFTYPE=:WFTYPE:, WFTDES=:WFTDES:, NEWUSER=:NEWUSER:, NEWTIME=:NEWTIME:,CHGUSER=:CHGUSER:, CHGTIME=:CHGTIME: WHERE   ROWNID=:ROWNID: ";
            or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
            Connect2Proxy(or1);
        }
    }
}
